package com.java.s4;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

public class testString {
    public static void main(String[] args) {
        StringBuffer stringBuffer=new StringBuffer("Hello");
        stringBuffer.append("world");
        stringBuffer.append("!!!");
        System.out.println(stringBuffer.toString());
        System.out.println("----------------------");
        System.out.println("String常用函数");
        String str1="helloworld";
        String str2="HELLOWORLD";
        System.out.println(str1.equals(str2));
        System.out.println(str1.equalsIgnoreCase(str2));
        System.out.println(str1.compareTo(str2));

        System.out.println("---------------------");
        System.out.println(str1.replaceAll("l", "_"));
        System.out.println(str2.replaceFirst("l","+"));

        System.out.println("-------字符串切割------");
        String str="Tom:90|Jerry:80|Tony:90";
        String result[]=str.split("\\|");
        for (int i = 0; i < result.length; i++) {
            String temp[]=result[i].split(":");
            System.out.println("姓名："+temp[0]+
                    "，成绩："+temp[1]);
        }
    }
}
